package com.demo.springBoot2.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class FilePathMapping implements WebMvcConfigurer {

    @Override
    public void addResourceHandlers(ResourceHandlerRegistry resourceHandlerRegistry){
        // 服务器的真实路径
        String pathUrl = "C:/111";
        // player_music 虚拟路径
        // 把虚拟路径和真实路径绑定
        resourceHandlerRegistry.addResourceHandler("player_music/**").addResourceLocations("file:"+pathUrl);
    }
}
